from sqlmodel import Field
from datetime import datetime
from app.core.base import BaseModel


class User(BaseModel, table=True):
    """
    用户模型类
    """

    username: str = Field(
        index=True,
        unique=True,
        description="用户名",
        min_length=3,
        max_length=10,
    )
    age: int | None = Field(default=None, description="年龄")
    email: str = Field(index=True, unique=True, max_length=255, description="电子邮箱")
    password: str = Field(description="密码", max_length=255)
    is_active: bool = Field(default=True, description="是否激活")
    is_superuser: bool = Field(default=False, description="是否为超级用户")
